package the.workshop.milktea.infrastructure.common;

import lombok.Getter;

import java.util.Arrays;

public enum CupTypeEnum {
    SMALL(1, "中杯"),
    BIG(2, "大杯");

    @Getter
    private Integer code;

    @Getter
    private String name;

    CupTypeEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public static String getName(int code) {
        return Arrays.stream(CupTypeEnum.values()).filter(it -> it.getCode() == code).findFirst().get().getName();
    }
}
